<?php
/**
 * 统计权限
 * User: cxm
 * Date: 2020/10/9
 * Time: 9:43
 */
namespace Seeds\Admin;

use App\Models\AdminPermission;
class CountSeeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public static function run()
    {
        // 一级
        $count = AdminPermission::create([
            'pid' => 0, 'sort' => 300, 'http_method' => ['GET'], 'name' => '统计管理', 'fid' => null, 'icon' => 'el-icon-s-data',
            'http_path' => 'javascript', 'menu_switch' => 2
        ]);
        /** ++++++++++++++++++++++++++++ 统计管理 start ++++++++++++++++++++++++++++++++++*/
        // 二级
        $user = AdminPermission::create([
            'pid' => $count->id, 'sort' => 10, 'http_method' => ['GET'], 'name' => '用户统计', 'fid' => null, 'icon' => '',
            'url'=>'statistics','http_path' => 'javascript', 'menu_switch' => 2
        ]);

        // 用户统计
        AdminPermission::create([
            'pid' => $user->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '统计数据', 'fid' => $user->id, 'icon' => '',
            'http_path' => '/admin/count/userStatistic', 'menu_switch' => 1
        ]);

        // 二级
        $random = AdminPermission::create([
            'pid' => $count->id, 'sort' => 10, 'http_method' => ['GET'], 'name' => '奖励统计', 'fid' => null, 'icon' => '',
            'url'=>'random_statistic','http_path' => 'javascript', 'menu_switch' => 2
        ]);

        // 统计数据
        AdminPermission::create([
            'pid' => $random->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '统计数据', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/count/randomStatistic', 'menu_switch' => 1
        ]);

        // 用户参与统计

        $user_sta = AdminPermission::create([
            'pid' => $count->id, 'sort' => 10, 'http_method' => ['GET'], 'name' => '用户参与统计', 'fid' => null, 'icon' => '',
            'url'=>'user_join_statistic','http_path' => 'javascript', 'menu_switch' => 2
        ]);

        // 参与列表
        AdminPermission::create([
            'pid' => $user_sta->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '用户列表', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/count/userJoinStatistic', 'menu_switch' => 1
        ]);

        // 导出
        AdminPermission::create([
            'pid' => $user_sta->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '导出', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/count/userJoinExport', 'menu_switch' => 1
        ]);

        // 参与人员统计
        AdminPermission::create([
            'pid' => $user_sta->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '参与人员统计', 'fid' => null, 'icon' => '',
            'http_path' => '/admin/count/userJoinChart', 'menu_switch' => 1
        ]);

        // 固定奖励活动
        AdminPermission::create([
            'pid' => $user_sta->id, 'sort' =>20, 'http_method' => ['POST'], 'name' => '固定奖励活动', 'fid' => $user_sta->id, 'icon' => '',
            'http_path' => '/admin/count/regularActivity', 'menu_switch' => 1
        ]);
        /** ++++++++++++++++++++++++++++ 统计管理 end ++++++++++++++++++++++++++++++++++*/
    }
}